package cate.game.pvp.ladder.msg;

import cate.game.GameBody;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInputTemplate;
import cate.game.client.msg.id.MsgIdBLadder;
import cate.game.pvp.ladder.common.LadderRefreshResult;
import cate.game.role.Role;

@ClientMsg(title = "天梯赛刷新 の 请求")
public class LadderRefreshReq extends MsgInputTemplate {

    @Override
    public MsgConfig conf() {
        return MsgIdBLadder.REFRESH_REQ;
    }

    @Override
    public void action(GameBody game, Role role) throws Exception {
        role.getPvp().ladder.refreshCheck();
        LadderRefreshResult result = role.getPvp().ladder.refresh();
        LadderRefreshResp resp = new LadderRefreshResp();
        resp.read(result);
        resp.sendNow(role);
    }

}
